cmake_minimum_required(VERSION 3.16)

project(qml_folderdialog VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTORCC ON)

find_package(Qt6 REQUIRED COMPONENTS Quick)

qt_standard_project_setup(REQUIRES 6.5)

set(PROJECT_SOURCES
    main.cpp
)

qt_add_executable(qml_folderdialog
    ${PROJECT_SOURCES}
)

qt_add_qml_module(qml_folderdialog
    URI qml_folderdialog
    VERSION 1.0
    QML_FILES
        FolderBrowser.qml
        Main.qml
    RESOURCES
        images.qrc
)

target_link_libraries(qml_folderdialog PRIVATE
    Qt6::Quick
)

set_target_properties(qml_folderdialog PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

include(GNUInstallDirs)
install(TARGETS qml_folderdialog
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
